<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <script src="vue.min.js"></script>
    <link rel="stylesheet" href="showstu.css">
    <script src="axios.js"></script>
</head>
<body>
<div class="tp"><h1>学生数据展示</h1></div>
    <div id="app">
        <div class="insert">
        <div v-show="show1">
<!--            学号:<input type="text" v-model="adddata.id"><br>-->
            姓名:<input type="text" v-model="adddata.name"><br>
            年龄:<input type="text" v-model="adddata.age"><br>
            爱好:<input type="text" v-model="adddata.hobit"><br>
            <button @click="add()" class="tj">提交</button>
        </div>

        <div class="update" v-show="show">
<!--            学号:<input type="text" v-model="adddata.id"><br>-->
            姓名:<input type="text" v-model="adddata.name"><br>
            年龄:<input type="text" v-model="adddata.age"><br>
            爱好:<input type="text" v-model="adddata.hobit"><br>
            <button @click="updateok()">更新数据</button>
        </div>

        </div>
        
        <table class="table">
            <tr class="tr">
                <th>ID</th>
                <th>姓名</th>
                <th>年龄</th>
                <th>爱好</th>
                <th>操作一</th>
                <th>操作二</th>
            </tr>
            <tr v-for="(value,index) in msg">
                <td class="td">{{msg[index].id}}</td>
                <td>{{msg[index].name}}</td>
                <td>{{msg[index].age}}</td>
                <td>{{msg[index].hobit}}</td>
                <td><a href="#" @click="del(index)">删除</a></td>
                <td><a href="#" @click="update(index)">更新</a></td>

            </tr>
        </table>
    </div>
<div class="banquan">版权来自princess.li,2024/8/8</div>
    <script src="showstu.js"></script>
</body>
</html>